--Create Table
IF NOT EXISTS (Select * from dbo.sysobjects where id=object_id('_TMP_SCRIPT_EXECUTION') and OBJECTPROPERTY(id,'IsUserTable')=1)
	CREATE TABLE [_TMP_SCRIPT_EXECUTION]([Id] int identity(1,1) NOT NULL, 
														[RunTime] DATETIME NOT NULL, 
														[Script] varchar(50) NOT NULL, 
														[Version] varchar(20) NOT NULL,
														[Descr] nvarchar(200) NULL);

GO
INSERT INTO [_TMP_SCRIPT_EXECUTION]([RunTime],[Script], [Version], [Descr]) VALUES(GetDate(), '2.CreateTables', '1.0.9330.1', 'Init database')

--Insert procedure
IF NOT EXISTS (Select * from dbo.sysobjects where id=object_id('_TMP_SCRIPT_EXECUTION') and OBJECTPROPERTY(id,'IsUserTable')=1)
	CREATE TABLE [_TMP_SCRIPT_EXECUTION]([Id] int identity(1,1) NOT NULL, 
														[RunTime] DATETIME NOT NULL, 
														[Script] varchar(50) NOT NULL, 
														[Version] varchar(20) NOT NULL,
														[Descr] nvarchar(200) NULL);

GO
INSERT INTO [_TMP_SCRIPT_EXECUTION]([RunTime],[Script], [Version], [Descr]) VALUES(GetDate(), '6.Procedures', '1.0.9330.1', 'Init database')